<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TblOaAuthRole> roleList = (List<TblOaAuthRole>)request.getAttribute("list");
	LeaveForm form = (LeaveForm)request.getAttribute("command");
%>
<div class="main">
	<div class="oaTable">
<table class="tableList">

	<thead>
		<tr>
			<td colspan="10" style="width: 100%;">
				<div class="FormTools">
					<div>角色名称：
						<input id="rolename" type="text" name="rolename" class="search" value="<%=StringUtils.isNotBlank(form.getRolename())?form.getRolename():""%>"
							placeholder="请输入角色名称"/>
						<input type="button" class="searchSubmit" onclick="javascript:XF.Check.roleListSearch()" value="搜索"/>
					</div>
					<div>所属公司：
						<select id="siteList" class="easyui-combobox" name="siteid" style="width:100px;"></select>
					</div>
				</div>
			</td>
		</tr>
	</thead>

	<tbody>
		<tr id="tableHeader">
			<th style="width: 10%">角色名称</th>
			<th style="width: 10%">权限</th>
			<th style="width: 10%">所属公司</th>
			<th style="width: 18%">操作</th>
		</tr>
		<%
			if(!CollectionUtils.isEmpty(roleList)){
       			for(int i=0;i<roleList.size();i++){
       				TblOaAuthRole role = roleList.get(i);
       				String id = EncrypTool.encode(role.getRoleId()+"");
       				String permissionNames = StringUtils.isNotBlank(role.getPermissionNames())?role.getPermissionNames():"";
       				if(permissionNames.length()>40){
       					permissionNames = permissionNames.substring(0, 40)+"...";
       				}
					%>
						<tr>
							<td><%=role.getRoleDesc() %></td>
							<td><a class="aText" title="<%=StringUtils.isNotBlank(role.getPermissionNames())?role.getPermissionNames():"" %>"><%=permissionNames %></a></td>
							<td><%=role.getSitename()%></td>
							<td>
								<div class="innerBtnWrap">
									<a class="a-btn-microsoft btn" href="javascript:XF.Check.deleteRole('<%=id %>')">删除</a>
									<a class="a-btn-microsoft btn" href="javascript:XF.Check.editRole('<%=id %>')">修改</a>
								</div>
							</td>
						</tr>
					<%
				}
			}
		%>
        <tr id="tableFooter">
			<td colspan="10">
				<div class="pagination">
					<monggoTag:pagination href="role_search"
						pageSize="<%=form.getPageSize()%>"
						totalRecord="<%=form.getTotalRecord() %>"
						currentPage="<%=form.getPageNum() %>">
					</monggoTag:pagination>
				</div>
			</td>
		</tr>
	</tbody>
</table>
</div>
</div>
<script>
$('#siteList').combobox({
	url:global.contextPath + '/company/siteList',
	valueField:'siteid',
	textField:'sitename',
});
$('#siteList').combobox('setValue', '<%=form.getSiteid() %>');
</script>